<!DOCTYPE html>
<html lang="en"  xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script src="./axios.min.js"></script>
	<script src="https://cdn.bootcdn.net/ajax/libs/vue-resource/1.5.1/vue-resource.min.js"></script>
    <script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/ant-design-vue@1.4.10/dist/antd.min.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.js"></script>
	<link href="https://cdn.jsdelivr.net/npm/ant-design-vue@1.4.10/dist/antd.min.css" rel="stylesheet" type="text/css" />
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js"></script>
	<style type="text/css">
		#app{
			margin:100px auto;
			text-align:center;
			width:300px;
		}
		.check{
			float:left;
		}
		#components-form-demo-normal-login .login-form {
			max-width:300px;
		}
		#components-form-demo-normal-login .login-form-forgot {
		  float: right;
		}
		#components-form-demo-normal-login .login-form-button {
		  width: 100%;
		}
	</style>
</head>
<body>
<div id="app">
  <img src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=630102928,3128643279&fm=26&gp=0.jpg" width="100px" height="100px"/>

  <h1>注册检查账号</h1>
  <a-form
    id="components-form-demo-normal-login"
    class="login-form"
  >
    <a-form-item>
      <a-input
        v-decorator="[
          'username',
          { rules: [{ required: true, message: 'Please input your old password!' }] },
        ]"
		v-model="username"
        placeholder="username"
      >
        <a-icon slot="prefix" type="user" style="color: rgba(0,0,0,.25)" />
      </a-input>
    </a-form-item>
	<a-form-item>
		<a-input
        v-decorator="[
          'password',
          { rules: [{ required: true, message: 'Please input your new Password!' }] },
        ]"
		type="password"
		v-model="password"
        placeholder="password"
      >
        <a-icon slot="prefix" type="lock" style="color: rgba(0,0,0,.25)" />
		</a-input>
    </a-form-item>
    <a-form-item>
      <a-input
        v-decorator="[
          'confirmPassword',
          { rules: [{ required: true, message: 'Please confirm your new Password!' }] },
        ]"
		v-model="confirmpassword"
        type="password"
        placeholder="confirm password"
      >
        <a-icon slot="prefix" type="lock" style="color: rgba(0,0,0,.25)" />
      </a-input>
    </a-form-item>
    <a-form-item>
      <a-button type="primary" @click="submit" class="login-form-button">
        注册
      </a-button>
    </a-form-item>
  </a-form>
</div>
<script>
    var app = new Vue({
        // e1: '#app',
        //注意这时l来着l
        el: '#app',
        data: {
            username: null,
            password: null,
			confirmpassword:null,
        },
        methods: {
			submit(){
				if(this.username!=null&&this.password!=null&&this.confirmpassword!=null){
					if(this.password==this.confirmpassword){
						var forms=new FormData();
						forms.set("username",this.username);
						forms.set("password",this.password);
						axios.post("http://47.94.215.148:8080/admin/addChe",forms,{
								withCredentials: true,
							}).then((res)=>{
							if(res.data.status==1){
								this.$message.success("添加成功！！");
								parent.app.getData();
								parent.app.close();
							}
							else{
								this.$message.error("添加失败~！！！");
							}
							});
					}
					else{
						this.$message.error("确认密码不正确！！！");
					}
				}
				else{
					this.$message.error("不能为空");
				}
			},
		}

    })
</script>
</body>
</html>